package vg.services.graph_view_manager.realization.graph_view.smart_graph_view.realization.actions;

import vg.services.graph_view_manager.interfaces.graph_view.IGraphRenderer;

/**
 * Undo/redo actions.
 *
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class UndoRedoAction extends DefaultActionAdapter {
    // undo action
    public static final int UNDO_ACTION = 1;
    // redo action
    public static final int REDO_ACTION = 2;

    // Main data
    private int action;

    public UndoRedoAction(int action) {
        super("undo/redo actions");

        this.action = action;
    }

    @Override
    public void action(final IGraphRenderer graphRenderer) {
        switch (action) {
            case UNDO_ACTION:
                graphRenderer.undo();
                break;
            case REDO_ACTION:
                graphRenderer.redo();
                break;
            default:
                break;
        }
    }
}
